package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.csg.vap.bean.VideoPerformance;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

public class GetVsPerformance extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		String statisticTarget = holder.getStrProperty("statisticTarget");
		
		VideoPerformance videoPerformance = vsClient.getVsPerformance(statisticTarget);
		Element usage = root.addElement("usage");
		usage.addElement("cpu").addText(toString(videoPerformance.getCpu()));
		usage.addElement("mem").addText(toString(videoPerformance.getMemory()));
		usage.addElement("disk").addText(toString(videoPerformance.getDisk()));
		usage.addElement("timestamp").addText(toString(videoPerformance.getTimestamp()));
		return root;
	}

}
